home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / nasa / erthtwin / erthtwin.bas < prev    next >
BASIC Source File  |  1995-05-02  |  6KB  |  156 lines

  1. 1 'ERTHTWIN.BAS: A program to explore the universe to find Earth's twin.  From
  2. 2 'Creative Computing November 1985 by Edward H. Carlson.
  3. 3 '
  4. 10 GOTO 1000
  5. 100 '
  6. 306 CLS:PRINT:PRINT:PRINT:PRINT
  7. 308 PRINT TAB(33)"STELLAR TYPES":PRINT
  8. 310 PRINT TAB(14)"Type       Temperature    Life time          Mass ":PRINT
  9. 311 PRINT TAB(11)"Blue giants    UV hot        Very short      30    to  3"
  10. 312 PRINT TAB(11)"Transition     Blue hot      Short            3    to  2"
  11. 313 PRINT TAB(11)"Solar types    White hot     Long             2    to   .5"
  12. 314 PRINT TAB(11)"Red dwarfs     Red hot       Very long         .5  to   .1"
  13. 315 PRINT:PRINT TAB(11)"Mass units = Sun's mass":PRINT
  14. 320 INPUT "          Star mass";M:IF M>30 OR M<.1 THEN 320
  15. 321 RANDOMIZE M
  16. 322 L=EXP(3.5*LOG(M)):PRINT
  17. 323 TA=EXP(-2.5*LOG(M))*10000!
  18. 324 Q=10:X=L:GOSUB 900:L=X
  19. 325 Q=10:X=TA:GOSUB 900:TA=X
  20. 328 FOR J=1 TO 63:IF M>S(J) THEN 330
  21. 329 NEXT J
  22. 330 CLS:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT TAB(10)"Spectra type of star:  ";S$(J):PRINT
  23. 332 PRINT TAB(10)"Luminosity of star:    ";L;"times the sun's brightness":PRINT
  24. 334 PRINT TAB(10)"Lifetime of star:      ";TA;"million years":PRINT
  25. 336 IF TA>12000! THEN PRINT TAB(10)"The star may be as old as the galaxy.":PRINT
  26. 338 PRINT TAB(10)"If there is a planetary system:":PRINT
  27. 340 IF TA<100 THEN PRINT T$(0):GOTO 350
  28. 342 IF TA<700 THEN PRINT T$(1):GOTO 350
  29. 344 IF TA<2000 THEN PRINT T$(2):GOTO 350
  30. 346 IF TA<4100 THEN PRINT T$(3):GOTO 350
  31. 348 :PRINT T$(4)
  32. 350 PRINT:PRINT TAB(10)"Do you want to investigate this star (Y/N)?"
  33. 352 Y$=INKEY$:IF Y$="" THEN X=RND(9):GOTO 352
  34. 354 IF Y$="y" OR Y$="Y" THEN GOSUB 400
  35. 355 END
  36. 400 CLS:PRINT:PRINT
  37. 404 SA=RND(9)*TA:IF SA>13000 THEN SA=13000
  38. 405 Q=10:X=SA:GOSUB 900:SA=X
  39. 406 PRINT TAB(16)"We find the system is";SA;"million years old."
  40. 407 PRINT:PRINT TAB(16)"(Solar system age = 4550 million years.)"
  41. 408 IF SA=13000 THEN PRINT:PRINT TAB(16)"Population II star, low in heavy elements."
  42. 409 PRINT
  43. 410 '
  44. 411 NP=6+INT(RND(9)*5)
  45. 412 SC=.3*SQR(M)*(.9+RND(9)*.2)*8/NP
  46. 414 A=SC
  47. 420 FOR I=1 TO NP
  48. 423 A=A*1.7*(.8+RND(9)*.4)
  49. 425 T(I)=SQR(A^3/M)
  50. 427 E(I)=.01*RND(9)*9
  51. 430 '
  52. 432 AC=4*L*L
  53. 434 A2=A^2
  54. 435 MC=M*1*(.3+RND(9)*1.4)*A2
  55. 436 MC=MC*.3^(A/4):MP=MC
  56. 437 IF A>AC THEN MP=MC*12
  57. 438 IF MP>3 THEN MP=MP^1.5
  58. 439 IF MP>999 THEN MP=MP/2:GOTO 439
  59. 440 IF MP<.01 THEN MP=.01
  60. 442 '
  61. 444 :C$(I)="rocky"
  62. 446 IF A>AC THEN C$(I)="icey"
  63. 448 IF MP>3 THEN C$(I)="gaseous"
  64. 450 '
  65. 451 R=MC^.33
  66. 452 IF MP<>MC THEN R=(MP*5)^.33
  67. 454 '
  68. 456 SG=MP/R/R
  69. 458 MP(I)=MP:A(I)=A:R(I)=R:SG(I)=SG
  70. 460 '
  71. 462 IF MP<2 THEN NM(I)=INT(RND(9)+.6):GOTO 490
  72. 464 IF MP>2 THEN NM(I)=INT((5.6*RND(9))+RND(9)*5*LOG(MP))
  73. 490 NEXT I
  74. 500 '
  75. 520 FOR I=1 TO NP
  76. 524 TI(I)=.1*RND(9)*3
  77. 526 D(I)=1
  78. 528 ST(I)=290*SQR(SQR(L)/A(I))
  79. 530 IF ST(I)>173 AND C$(I)="icey" THEN MP(I)=MP(I)/12:C$(I)="rocky"
  80. 532 IF ST(I)>2000 THEN MP(I)=0:C$(I)="evaporated"
  81. 538 NEXT I:GOSUB 700
  82. 550 '
  83. 599 RETURN
  84. 600 '
  85. 700 '
  86. 712 PRINT TAB(32)"PLANETS":PRINT
  87. 716 PRINT"      orbit    period    mass  surface  surf.  composition moons"
  88. 718 PRINT" #    radius                   gravity  temp.":PRINT
  89. 730 FOR I=1 TO NP
  90. 732 Q=10:X=A(I):GOSUB 900:A(I)=X
  91. 734 Q=10:X=SG(I):GOSUB 900:SG(I)=X
  92. 736 Q=10:X=MP(I):GOSUB 900:MP(I)=X
  93. 738 Q=10:X=ST(I):GOSUB 900:ST(I)=X-270
  94. 740 Q=10:X=T(I):GOSUB 900:T(I)=X
  95. 742 PRINT I;TAB(6):IF C$(I)="evaporated" THEN PRINT C$(I):GOTO 770
  96. 744 PRINT USING "###.##";A(I);
  97. 746 PRINT TAB(15);
  98. 748 PRINT T(I);
  99. 750 PRINT TAB(24);
  100. 752 PRINT USING "###.##";MP(I);
  101. 754 PRINT TAB(31);
  102. 756 PRINT USING "###.##";SG(I);
  103. 758 PRINT TAB(41);
  104. 760 PRINT USING "####.";ST(I);
  105. 762 PRINT TAB(51);
  106. 764 PRINT C$(I);
  107. 766 PRINT TAB(61);
  108. 768 PRINT NM(I)
  109. 770 NEXT I
  110. 772 PRINT:PRINT "units: AU     years    earth's earth's    C"
  111. 799 PRINT:INPUT"                Do you want to investigate another star (Y/N)";A$
  112. 800 IF A$="Y" OR A$="y" THEN GOTO 100
  113. 801 IF A$="N" OR A$="n" THEN PRINT:PRINT TAB(20)"Returning you to Earth, enjoy the voyage!"
  114. 900 '
  115. 906 IF X=0 THEN RETURN
  116. 910 N=0:IF X<2*Q THEN 930
  117. 914 :IF X>=20*Q THEN X=X/10:N=N+1:GOTO 914
  118. 918 X=INT(X+.5):IF N=0 THEN RETURN
  119. 920 FOR K=1 TO N:X=X*10:NEXT K:RETURN
  120. 930 :IF X<2*Q THEN X=X*10:N=N+1:GOTO 930
  121. 934 X=INT(X+.5):IF N=0 THEN RETURN
  122. 936 FOR K=1 TO N:X=X/10:NEXT K:RETURN
  123. 1000 '
  124. 1020 CLS:PRINT:PRINT:PRINT TAB(22)"THE EARTH'S TWIN -- AN ASTRONOMY GAME":PRINT:PRINT
  125. 1030 PRINT"GAME OBJECTIVE: Come search the galaxy for a twin planet to Earth--one we can"
  126. 1031 PRINT"colonize.  Pick a nearby star that has a desirable mass.":PRINT
  127. 1032 PRINT"GAME PURPOSE: This program will show the relationship between the mass and"
  128. 1033 PRINT"lifetime of a star, how narrow the zone of habitability is around a star, and"
  129. 1034 PRINT"planetary orbital parameters in relation to the mass of the parent star.":PRINT
  130. 1090 PRINT"NOTICE: Due to a strange bug in the way the program handles the randomizing"
  131. 1091 PRINT"function, sometimes our galactic voyage navigates a little too close to a black"
  132. 1092 PRINT"hole which sucks the quarks out of the warp drive engines.  This will terminate"
  133. 1093 PRINT"the program.  If this happens, sack the navigator, reboot the program, and we"
  134. 1094 PRINT"catch the next starship out!":PRINT:PRINT
  135. 1095 PRINT TAB(25)"Created by Edward H. Carlson":PRINT
  136. 1096 PRINT TAB(20)"Modified for ATARI ST by Robert Reeves":PRINT
  137. 1100 PRINT TAB(23)"Press the Space Bar to continue."
  138. 1110 Y$=INKEY$:IF Y$<>" " THEN X=RND(9):GOTO 1110
  139. 1999 PRINT" Wait"
  140. 2000 '
  141. 2120 DIM ST(20),S(65),S$(65)
  142. 2160 DATA 30,26,23,19.9,17.3,15.1,13.2,11.5,10,8.4,7.1,6,5,4.2,3.6,3,2.9,2.7,2.6,2.5,2.3
  143. 2161 DATA 2.2,2.1,2,1.91,1.82,1.73,1.65,1.57,1.49,1.42,1.35,1.28,1.22,1.16,1.11,1.05,1,.95,.9,.85,.81,.77,.73,.69,.66,.62,.59,.56,.53,.51,.48,.46,.43,.41
  144. 2162 DATA .39,.37,.35,.33,.25,.183,.135,.1
  145. 2165 DATA O5,O6,O7,O8,O9,B0,B1,B2,B3,B4,B5,B6,B7,B8,B9,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,G0,G1,G2,G3,G4,G5,G6,G7,G8,G9
  146. 2166 DATA K0,K1,K2,K3,K4,K5,K6,K7,K8,K9,M0,M1,M2,M3,M4,M5,M6,M7
  147. 2168 :FOR J=1 TO 63:READ S(J):NEXT J
  148. 2169 :FOR J=1 TO 63:READ S$(J):NEXT J
  149. 2180 T$(0)="        The star may explode in the near future!"
  150. 2181 T$(1)="        The system is too young for life to have developed."
  151. 2182 T$(2)="        There may be unicellular life, but no oxygen on any planets."
  152. 2183 T$(3)="        There may be oxygen and lower lifeforms present."
  153. 2184 T$(4)="        There may be higher lifeforms on some planets."
  154. 2999 GOTO 100
  155.  
  156.